#include <iostream>
using namespace std;
class temp
{
public:
	int num1,num2;
	virtual ~temp()
	{
		cout << "父析构" << endl;
	}
	virtual int getres(){return 0;}
};
class temp1:public temp
{
public:
	~temp1()
	{
		cout << "子析构" << endl;
	}
	int getres()
	{
		return num1+num2;
	}
};
int main()
{
	temp*p=new temp1;
	p->num1=10;
	p->num2=20;
	cout << p->getres() << endl;
	delete p;
	return 0;
}

